//
//  IndustrialViewController.m
//  Logistics
//
//  Created by hy002 on 2018/1/12.
//  Copyright © 2018年 HUYU. All rights reserved.
//

#import "IndustrialViewController.h"
#import "CompanyInfoModel.h"

@interface IndustrialViewController ()

@end

@implementation IndustrialViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self creatUI];
}

- (void)creatUI
{
    self.navigationItem.title = @"工商信息";
    self.view.backgroundColor = BacksColor;
    self.navigationController.navigationBar.translucent = NO;
    CompanyInfoModel *infoModel = _model.companyInfo;
    UIView *topView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 140*displaywidth)];
    topView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:topView];
    UIImageView *imgView = [ZCControl createImageViewWithFrame:CGRectMake(SCREEN_WIDTH/2-25*displaywidth, 20*displaywidth, 50*displaywidth, 60*displaywidth) ImageName:@"gsxy_icon04"];
    imgView.contentMode = UIViewContentModeScaleAspectFit;
    [topView addSubview:imgView];
    UILabel *titLab = [ZCControl createLabelWithFrame:CGRectMake(0, 80*displaywidth, SCREEN_WIDTH, 25*displaywidth) Font:18.0 Text:@"工商认证信息" Color:RGB(20, 43, 126)];
    titLab.textAlignment = NSTextAlignmentCenter;
    [topView addSubview:titLab];
    UILabel *detaLab = [ZCControl createLabelWithFrame:CGRectMake(0, 105*displaywidth, SCREEN_WIDTH, 35*displaywidth) Font:10.0 Text:[NSString stringWithFormat:@"认证对象：%@\n信息来源：%@",_model.companyName,infoModel.souce] Color:BlaTitColor];
    detaLab.textAlignment = NSTextAlignmentCenter;
    detaLab.numberOfLines = 2;
    [topView addSubview:detaLab];
    NSArray *leftAry = @[@"注册号：",@"经营状态：",@"登记机关：",@"发照日期：",@"公司类型：",@"成立日期：",@"注册地址：",@"法定代表：",@"注册资本：",@"营业期限：",@"经营范围："];
    NSArray *rightAry = @[infoModel.mark,infoModel.state,infoModel.department,infoModel.issueDate,infoModel.companyType,infoModel.establishDate,infoModel.address,infoModel.deputy,string(infoModel.bankroll, @"万元人民币"),infoModel.period,infoModel.scope];
    CGFloat H = 150*displaywidth;
    for (int i = 0; i < leftAry.count; i++)
    {
        UILabel *leftLab = [ZCControl createLabelWithFrame:CGRectMake(0, H, 80*displaywidth, 25*displaywidth) Font:12.0 Text:leftAry[i] Color:BlaTitColor];
        leftLab.textAlignment = NSTextAlignmentRight;
        [self.view addSubview:leftLab];
        UILabel *rightLab = [ZCControl createLabelWithFrame:CGRectMake(85*displaywidth, H, SCREEN_WIDTH-90*displaywidth, 25*displaywidth) Font:12.0 Text:rightAry[i] Color:RGB(153, 153, 153)];
        if (i == leftAry.count-1)
        {
            CGRect bounds = [rightLab.text boundingRectWithSize:CGSizeMake(SCREEN_WIDTH-100*displaywidth, 2000) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObject:NormalFontWithSize(12.0+fontScale) forKey:NSFontAttributeName] context:nil];
            if (bounds.size.height > 25*displaywidth)
            {
                rightLab.frame = CGRectMake(85*displaywidth, H, SCREEN_WIDTH-100*displaywidth, bounds.size.height+10*displaywidth);
            }
        }
        [self.view addSubview:rightLab];
        H+=25*displaywidth;
    }
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
